<template>
  <div class="score-wrapper">
    <div class="score-form">
      <div class="score-title">
        项目名称
      </div>
      <div class="score-content">
        {{form.projectName}}
      </div>
    </div>
    <div class="score-form">
      <div class="score-title">
        项目简介
      </div>
      <div class="score-content">
        {{form.projectRemark}}
      </div>
    </div>
    <div class="score-form">
      <div class="score-title">
        考核名称
      </div>
      <div class="score-content">
        {{form.evItemName}}
      </div>
    </div>
    <div class="score-form">
      <div class="score-title">
        考核内容描述
      </div>
      <div class="score-content">
        {{form.evItemContent}}
      </div>
    </div>
    <div class="score-form">
      <div class="score-title">
        项目成员
      </div>
      <div class="score-content">
        {{form.members}}
      </div>
    </div>
    <div class="score-form">
      <div class="score-title">
        考核分数
      </div>
      <div class="score-content">
        <el-rate :disabled="form.status !== 5" v-model="scoreform.scores" :max="10" style="margin-top:8px;"></el-rate>
      </div>
    </div>
    <div class="score-form">
      <div class="score-title">
        评分依据
      </div>
      <div class="score-content">
        <el-input :disabled="form.status !== 5" type="textarea" :rows="5" placeholder="请输入评分的依据" v-model="scoreform.remark"></el-input>
      </div>
    </div>
    <div class="bottom-btn">
      <div @click="close">关闭</div>
      <div v-if="form.status === 5" @click="assess">确定</div>
    </div>
  </div>
</template>

<script>
import formUtil from '@/utils/formUtil';

export default {
  data() {
    return {
      form:{
       
      },
      scoreform: {
        scores: 0,
        remark: '',
        scoresId: ''
      },
    }
  },
  mounted() {
    this.form = this.$route.params.detail;
    this.scoreform.scores = this.form.scores ? this.form.scores: 0;
    this.scoreform.remark = this.form.remark;
    this.scoreform.scoresId = this.form.scoreId;
  },
  methods: {
    async assess() {
      if(this.form.status === 5) {
        if(!await this.$httpN.postQ('pde/scores/give', this.scoreform)) return;
        formUtil.submitSuccess('打分成功');
        this.$router.go(-1);
      }else{
        this.$router.go(-1);
      }
    },
    close() {
      this.$router.go(-1);
    }
  }
}
</script>

<style lang="scss" scoped>
  .score-wrapper{
    min-height: 100vh;
    background: #FFF;
    padding: 12px;
    position: relative;
    .score-form{
      margin-bottom: 10px;
      .score-title{
        margin-bottom: 5px;
        font-weight: bold;
      }
    }
    .bottom-btn{
      position: absolute;
      bottom: 0;
      right:0;
      width: 100%;
      display: flex;
      div{
        flex:1;
        text-align: center;
        line-height: 50px;
        background: #F2F2F2;
        color: #8D8F96;
      }
      >div:nth-child(2){
        color:white;
        background: #639EFC;
      }
    }
  }
</style>